<template>
  <div>
    <p>{{ $store.state.count }}</p>
    <p>{{ $store.state.count&1?'奇数':'偶数' }}</p>
    <button @click="increment">+</button>
    <button @click="decrement">-</button>
    <button @click="incrementIffOdd">incrementIffOdd</button>
    <button @click="incrementAsync">incrementAsync</button>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
    increment() {
      const { dispatch } = this.$store
      dispatch('increment', 1)
    },
    decrement() {
      const { dispatch } = this.$store
      dispatch('decrement', 1)
    },
    incrementIffOdd() {
      const { dispatch } = this.$store
      dispatch('incrementIffOdd', 1)
    },
    incrementAsync() {
      const { dispatch } = this.$store
      dispatch('incrementAsync', 1)
    },
  },
}
</script>

<style></style>
